package com.cr.mrapp.service.impl;

import com.cr.mrapp.dao.StoreDao;
import com.cr.mrapp.entity.Store;
import com.cr.mrapp.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StoreServiceImpl implements StoreService {

    @Autowired
    private StoreDao storeDao;

    @Override
    public int addStore(Store body) {
        return storeDao.insert(body);
    }

    @Override
    public List<Store> list() {
        return storeDao.selectAll();
    }

    @Override
    public List<Object> findByPage(int page, int limit) {
        return storeDao.selectByPage((page-1)*limit,limit);
    }

    @Override
    public int findCount() {
        return storeDao.selectCount();
    }

    @Override
    public int deleteById(int storeId) {
        return storeDao.deleteByPrimaryKey(storeId);
    }
}
